<?php

/**
 * FamilleArticle form base class.
 *
 * @method FamilleArticle getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseFamilleArticleForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                         => new sfWidgetFormInputHidden(),
      'libelle'                    => new sfWidgetFormInputText(),
      'coefficient_multiplicateur' => new sfWidgetFormInputText(),
      'suivi_stock'                => new sfWidgetFormInputCheckbox(),
      'garantie'                   => new sfWidgetFormInputText(),
      'delai_livraison'            => new sfWidgetFormInputText(),
      'escompte'                   => new sfWidgetFormInputCheckbox(),
      'publie'                     => new sfWidgetFormInputCheckbox(),
      'id_unite'                   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Unite'), 'add_empty' => true)),
      'id_tva'                     => new sfWidgetFormInputText(),
      'created_at'                 => new sfWidgetFormDateTime(),
      'updated_at'                 => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'libelle'                    => new sfValidatorString(array('max_length' => 20)),
      'coefficient_multiplicateur' => new sfValidatorNumber(array('required' => false)),
      'suivi_stock'                => new sfValidatorBoolean(),
      'garantie'                   => new sfValidatorInteger(),
      'delai_livraison'            => new sfValidatorInteger(array('required' => false)),
      'escompte'                   => new sfValidatorBoolean(array('required' => false)),
      'publie'                     => new sfValidatorBoolean(array('required' => false)),
      'id_unite'                   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Unite'), 'required' => false)),
      'id_tva'                     => new sfValidatorInteger(),
      'created_at'                 => new sfValidatorDateTime(),
      'updated_at'                 => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('famille_article[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'FamilleArticle';
  }

}
